int icon;
char *src;
char *ident;
+ char *ascii_description;
char zbuf[25];
char ffbuf[25];
int display = 1;
icon = mps_converted_icon_number(icon, mps_ver, MAPSOURCE);
/* two NULL (0x0) bytes at end of each string */
- reclen = strlen(ident) + ((wpt->description) ? strlen(wpt->description) : 0) + 2;
+ ascii_description = wpt->description ? str_utf8_to_ascii(wpt->description) : xstrdup("");
+ reclen = strlen(ident) + strlen(ascii_description) + 2;
if ((mps_ver == 4) || (mps_ver == 5)) {
/* v4.06 & V5.0*/
reclen += 85; /* "W" (1) + strlen(name) + NULL (1) + class(4) + country(sz) +
fwrite(hdr, 1 , 1, mps_file);
fwrite(&mps_altitude, 8 , 1, mps_file);
}
-
- if (wpt->description) fputs(wpt->description, mps_file);
+ if (wpt->description) fputs(ascii_description, mps_file);
fwrite(zbuf, 1, 1, mps_file); /* NULL termination */
+ xfree(ascii_description);
+ ascii_description = NULL;
if (mps_proximity == unknown_alt) {
fwrite(zbuf, 9, 1, mps_file);
unsigned short version;
unsigned long count;
unsigned long recsize;
- unsigned char *record;
unsigned short stringlen;
+ unsigned char *record;
static int serial = 0;
struct ll {
long lat;
stringlen = le_read16((unsigned short *)(record + 0x1a));
Skip(infile, stringlen - 4);
- free(record);
+ xfree(record);
/*
* end of filename record
wpt_tmp->shortname = xmalloc(7);
sprintf( wpt_tmp->shortname, "\\%5.5x", serial++ );
route_add_wpt(track_head, wpt_tmp);
+ xfree(record);
} else {
Skip(infile, recsize);
/*
latlon++;
coordcount--;
}
- free(record);
+ xfree(record);
}
/*
* end of routing
fprintf(file_out, "%f,%f:%s", lon, lat, pin);
if (!nolabels) {
char *desc = csv_stringclean(wpt->description, ":");
+ char *adesc = str_utf8_to_ascii(desc);
if (global_opts.synthesize_shortnames)
- desc = mkshort(mkshort_whandle, desc);
- fprintf(file_out, ":%s", desc);
+ adesc = mkshort(mkshort_whandle, adesc);
+ fprintf(file_out, ":%s", adesc);
xfree(desc);
+ xfree(adesc);
}
fprintf(file_out, "\n");
}